Release 10.1A: OpenEdge Development:
Programming Interfaces
SAX-attributes object
When the parser encounters an XML Start-Tag that has one or more attributes, such as:
it populates the Start Element callback’s attributes parameter with information on the element’s attributes (in the example, “name” and “id”). In Progress, the attributes parameter is a handle to a Progress
SAX-attributesobject, which is similar to the Attributes interface of the Java Sax2 API.The attributes and methods associated with the
SAX-attributesobject are summarized in Table 20–3. For reference entries, see the OpenEdge Development: Progress 4GL Reference .
A
Note: The order of the elements on the list might not be the same as the order in which they appear in the document — which is consistent with the SAX2 Java API specification.SAX-attributesobject is a collection of all the attributes for a given element. No matter how many attributes an element has, StartElement gets passed only one attributes handle. Think of it as a list of the attributes associated with the element.To get the information about each attribute from a
SAX-attributesobject, use theGET-XXXmethods. They let your application to get theSAX-attributesdata in either of two different ways:
- You can traverse the list, getting each attribute’s data in turn by using the
GET-XXX-BY-INDEXmethods.- You can use an attribute’s name to get its data.
This approach has variations, depending on whether you are using namespace processing or not. For more information on this point, see the "Namespace Processing" section.)
There are 6 pieces of information you can get on each attribute, though three are variations on the name. Each
GET-XXXmethod gets you one piece of information. The six pieces of information and theGET-XXXmethods are explained in Table 20–4.
If the parser is doing Namespace processing — that is, if
Note: An unprefixed attribute name does not use the default Namespace, if any; it is not associated with any Namespace. This contrasts with the case for Elements, where unprefixed Element names use the default Namespace, if any.SAX-reader’sSUPPRESS-NAMESPACE-PROCESSINGattribute is set to “NO” (the default) — each attribute that has a namespace prefix will have non-empty URI, localName, and qName data. An attribute that has noNamespace prefix will have an empty URI, but its localName and qName will have values.If the parser is not doing Namespace processing, each attribute will have only a qName.
In all cases, the
qNamewill be exactly what appears in the XML document.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |